
 
package com.junitUtil.spring;	
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.support.DelegatingSmartContextLoader;
import org.springframework.test.util.ReflectionTestUtils;




/**
 * 使用自定义的ContextLoader
 * 
 **/

public class TestLoader extends DelegatingSmartContextLoader {

    private  AnnotationConfigContextLoaderDecorator   loader = new  AnnotationConfigContextLoaderDecorator  ();
    public TestLoader() {
    }

    @Override
    public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
        ReflectionTestUtils.setField(this, "annotationConfigLoader", this.loader);
        return super.loadContext(mergedConfig);
    }
    
}

